﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace Asion.Dapper.SqlBuilder
{
    /// <summary>
    /// sql注入清理
    /// </summary>
    public class SqlInjectionCleaner
    {
        // 正则表达式匹配SQL注入相关的特殊字符
        private static readonly Regex _sqlInjectionRegex = new Regex(@"[;:-\/.,']", RegexOptions.Compiled);

        public static string Clean(string input)
        {
            // 使用正则表达式替换掉匹配到的特殊字符
            return _sqlInjectionRegex.Replace(input, "");
        }
    }
}
